<?php

/**
 *
 * 版权所有：恰维网络<qwadmin.qiawei.com>
 * 作    者：寒川<hanchuan@qiawei.com>
 * 日    期：2016-01-20
 * 版    本：1.0.0
 * 功能说明：用户控制器。
 *
 * */

namespace Qwadmin\Controller;

use Common\Controller\OdooApiController;
use Common\Upload;

//use Common\Controller\openerp;

class CommentController extends ComController {
    /*
     * 商品列表
     */

    public function index() {
       session_start();
	   $goods=M('gxhwgoods')->where('status=0')->order(' RAND() ')->find();
	   
	   $page=$goods['page']?$goods['page']+1:1;
	   //$maxpage=is_integer($goods['page'])?$goods['page']+1:1;
	   $url="http://www.coopoverseasbuy.com/detail/".$goods['goods_id'].".html#!&page=".$page;
	   //echo "currpage:". $page ."<br>";
	   //echo "cur-url".$url."<br>";
	   $this->assign('url', $url);
	   $this->assign('goodsid', $goods['goods_id']);
	   
	   $this->assign('page', $page);
	   //var_dump($goods);
	   $this->display();
    }

	public function get(){
		
		   file_put_contents("comentlist/".$_POST['goods']."_".$_POST['page'].".txt",$_POST['data']);
		   $status=($_POST['page']==0)?1:2;
		   if($_POST['max_page']<0) $status=1;
		   $data=array('goods_id'=>$_POST['goods'],'page'=>$_POST['page'],'maxpage'=>$_POST['max_page'],'status'=>$status,'skuid'=>$_POST['skuid']);
		   // file_put_contents("comentlist/".$_POST['goods']."_".$_POST['page']."_log.txt",$_POST['goods']."----".$_POST['page']."----".$_POST['max_page']."----".strlen($_POST['data']));
		   $model=M('gxhwgoods')->where("goods_id='".$_POST['goods']."'")->save($data);
		
	}
    /*
     * 商品添加
     */
 
}

